package cate.game.role.res.guild.boss.msg;

import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdGuild;
import cate.game.role.res.guild.boss.GuildBossRankPO;
import easy.java.dev.note.NoteField;
import easy.java.practice.errorcode.EcResult;


@ClientMsg(title = "公会boss的排行榜 の 请求")
public class GuildBossRankReq implements MsgInput {
    @NoteField("BOSS序号")
    public int combatNum;

    @Override
    public MsgConfig conf() {
        return MsgIdGuild.BOSS_RANK_REQ;
    }

    @Override
    public void execute(GameBody game, ClientContext cc) {
        EcResult<GuildBossRankPO> r = game.res.guild.bossRankCache.tryGetRoleRankPO(cc.getRole(), combatNum);
        if(!r.ok()){
            game.notice.message(cc.getRole(), r);
            return;
        }
        cc.getRole().sendNow(new GuildBossRankResp(combatNum, r.data));
    }
}
